package CezarCipher;

public class CipherManager
{

    public String Encrypt(char[] chars, String key, String type) {
        ICipher cipher = getCipherByType(type);
        return cipher.Encrypt(chars, key);
    }

    public String Decrypt(char[] chars, String key, String type) {
        ICipher cipher = getCipherByType(type);
        return cipher.Decrypt(chars, key);
    }

    private ICipher getCipherByType(String type) {
        if (type.equalsIgnoreCase("cezar")) {
            return new CezarCipher();
        }
        else {
            return new VigenerCipher();
        }
    }
}
